﻿using System;
using System.Web.UI;
using Lir.Pager.Entity;
using QuickORM.BLL;

public partial class Manage_WebPages_Message_MessageList : Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            var id = Request.QueryString["type"];
            if (!string.IsNullOrEmpty(id))
            {
                if (id == "1")
                {
                    ViewState["typeName"] = "通知公告";
                }
                else if (id == "2")
                {
                    ViewState["typeName"] = "资讯";
                }
                else if (id == "3")
                {
                    ViewState["typeName"] = "文件下载";
                }
                else if (id == "4")
                {
                    ViewState["typeName"] = "学术园地";
                }
                else
                {
                    ViewState["typeName"] = "";
                }
                Query(ViewState["typeName"].ToString());
            }
        }
    }

    #region 分页处理

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        Query(ViewState["typeName"].ToString());
    }

    #endregion

    #region 查询方法

    /// <summary>
    ///     检索条件
    /// </summary>
    /// <param name="name"></param>
    protected void Query(string typeName)
    {
        var pager = new PagerInfo();
        pager.CurrenetPageIndex = AspNetPager1.CurrentPageIndex;
        pager.PageSize = AspNetPager1.PageSize;
        rptList.DataSource = BLLFactory<T_ManagerInfoManager>.Instance.FindWithPager(string.Format("M_Type='{0}'", typeName), pager, "M_Time", true);
        rptList.DataBind();
        AspNetPager1.RecordCount = pager.RecordCount;
    }

    #endregion
}